home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / chat / reflect.000 / reflect / 3.0b3 / rtp.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-01-11  |  4.4 KB  |  159 lines

  1. /*
  2.  * rtp.h
  3.  *
  4.  * Constants and structures based on the 12/15/92 draft of the RTP protocol
  5.  * Internet Draft. This information is still subject to change.
  6.  *
  7.  */
  8.  
  9. #ifndef _rtp_h
  10. #define _rtp_h
  11.  
  12. #define RTP_VERSION    1
  13.  
  14. /* Offset from UNIX's epoch to the NTP epoch in seconds (NTP's JAN_1970) */
  15. #ifndef RTP_EPOCH_OFFSET
  16. #define RTP_EPOCH_OFFSET    2208988800UL
  17. #endif
  18.  
  19. typedef unsigned long uint32;
  20. typedef unsigned short uint16;
  21. typedef unsigned char uint8;
  22.  
  23.  
  24. /* Basic RTP header */
  25. struct rtphdr {
  26. #ifndef LITTLE_BITFIELDS
  27.     uint8    rh_vers:2;    /* version */
  28.     uint8    rh_chanid:6;    /* channel id */
  29.     uint8    rh_opts:1;    /* options present */
  30.     uint8    rh_sync:1;    /* end of synchronization unit */
  31.     uint8    rh_content:6;    /* content id */
  32. #else
  33.     uint8    rh_chanid:6;    /* channel id */
  34.     uint8    rh_vers:2;    /* version */
  35.     uint8    rh_content:6;    /* content id */
  36.     uint8    rh_sync:1;    /* end of synchronization unit */
  37.     uint8    rh_opts:1;    /* options present */
  38. #endif
  39.     uint16    rh_seq;        /* sequence number */
  40.     uint32    rh_ts;        /* time stamp (middle of NTP timestamp) */
  41. };
  42.  
  43. /* Basic RTP option header */
  44. struct rtpopthdr {
  45. #ifndef LITTLE_BITFIELDS
  46.     uint8    roh_fin:1;    /* final option flag */
  47.     uint8    roh_type:7;    /* option type */
  48. #else
  49.     uint8    roh_type:7;    /* option type */
  50.     uint8    roh_fin:1;    /* final option flag */
  51. #endif
  52.     uint8    roh_optlen;    /* option len */
  53. };
  54.  
  55. /* Normal RTP options */
  56. #define RTPOPT_CSRC    0    /* Content source */
  57. #define RTPOPT_SSRC    1    /* Synchronization source */
  58. #define RTPOPT_BOP    2    /* Beginning of playout unit */
  59.  
  60. /* RTP synchronization source (SSRC) option header */
  61. struct rtpssrchdr {
  62. #ifndef LITTLE_BITFIELDS
  63.     uint8    rsh_fin:1;    /* final option flag */
  64.     uint8    rsh_type:7;    /* option type */
  65. #else
  66.     uint8    rsh_type:7;    /* option type */
  67.     uint8    rsh_fin:1;    /* final option flag */
  68. #endif
  69.     uint8    rsh_optlen;    /* option len (== 2) */
  70.     uint16    rsh_id;        /* source identifier */
  71.     uint32    rsh_addr;    /* IP address of host */
  72. };
  73.  
  74. /* RTP BOP option header */
  75. struct rtpbophdr {
  76. #ifndef LITTLE_BITFIELDS
  77.     uint8    rbh_fin:1;    /* final option flag */
  78.     uint8    rbh_type:7;    /* option type */
  79. #else
  80.     uint8    rbh_type:7;    /* option type */
  81.     uint8    rbh_fin:1;    /* final option flag */
  82. #endif
  83.     uint8    rbh_optlen;    /* option len (== 1) */
  84.     uint16    rbh_seq;    /* sequence number of BOP */
  85. };
  86.  
  87. /* RTCP forward direction options */
  88. #define RTPOPT_FMT    32    /* Format description */
  89. #define RTPOPT_SDESC    33    /* Source description */
  90. #define RTPOPT_BYE    35    /* Conference exit notification */
  91.  
  92. /* RTCP CDESC option header */
  93. struct rtcpfmthdr {
  94. #ifndef LITTLE_BITFIELDS
  95.     uint8    rtfh_fin:1;    /* final option flag */
  96.     uint8    rtfh_type:7;    /* option type */
  97. #else
  98.     uint8    rtfh_type:7;    /* option type */
  99.     uint8    rtfh_fin:1;    /* final option flag */
  100. #endif
  101.     uint8    rtfh_optlen;    /* option len */
  102. #ifndef LITTLE_BITFIELDS
  103.     uint8    rtfh_x1:2;    /* reserved (must be 0) */
  104.     uint8    rtfh_fmt:6;    /* format id */
  105. #else
  106.     uint8    rtfh_fmt:6;    /* format id */
  107.     uint8    rtfh_x1:2;    /* reserved (must be 0) */
  108. #endif
  109.     uint8    rtfh_cqual;    /* clock quality */
  110. };
  111.  
  112. /* RTCP SDESC option header */
  113. struct rtcpsdeschdr {
  114. #ifndef LITTLE_BITFIELDS
  115.     uint8    rtsh_fin:1;    /* final option flag */
  116.     uint8    rtsh_type:7;    /* option type */
  117. #else
  118.     uint8    rtsh_type:7;    /* option type */
  119.     uint8    rtsh_fin:1;    /* final option flag */
  120. #endif
  121.     uint8    rtsh_optlen;    /* option len */
  122.     uint16    rtsh_id;    /* content source id */
  123.     uint32    rtsh_addr;    /* IP address of host */
  124. };
  125.  
  126. /* RTCP BYE option header */
  127. struct rtcpbyehdr {
  128. #ifndef LITTLE_BITFIELDS
  129.     uint8    rtbh_fin:1;    /* final option flag */
  130.     uint8    rtbh_type:7;    /* option type */
  131. #else
  132.     uint8    rtbh_type:7;    /* option type */
  133.     uint8    rtbh_fin:1;    /* final option flag */
  134. #endif
  135.     uint8    rtbh_optlen;    /* option len */
  136.     uint16    rtbh_id;    /* content source id */
  137. };
  138.  
  139. /* RTP standard content encodings for audio */
  140. #define RTPCONT_PCMU        0    /* 8kHz PCM mu-law mono */
  141. #define RTPCONT_1016        1    /* 8kHz CELP (Fed Std 1016) mono */
  142. #define RTPCONT_G721        2    /* 8kHz G.721 ADPCM mono */
  143. #define RTPCONT_GSM        3    /* 8kHz GSM mono */
  144. #define RTPCONT_G723        4    /* 8kHz G.723 ADPCM mono */
  145. #define RTPCONT_DVI        5    /* 8kHz Intel DVI ADPCM mono */
  146. #define RTPCONT_L16_16        6    /* 16kHz 16-bit linear mono */
  147. #define RTPCONT_L16_44_2    7    /* 44.1kHz 16-bit linear stereo */
  148.  
  149. /* RTP standard content encodings for video */
  150. #define RTPCONT_CELLB        25    /* Sun CellB */
  151. #define RTPCONT_JPEG        26    /* JPEG */
  152. #define RTPCONT_CUSEEME        27    /* Cornell CU-SeeMe */
  153. #define RTPCONT_NV        28    /* Xerox PARC nv */
  154. #define RTPCONT_PICWIN        29    /* BBN Picture Window */
  155. #define RTPCONT_CPV        30    /* Bolter CPV */
  156. #define RTPCONT_H261        31    /* CCITT H.261 */
  157.  
  158. #endif /*_rtp_h*/
  159.